<!DOCTYPE HTML>
<html>
	<head>
		<script type="text/javascript" src="../Mr.async.js"></script>
		<script type="text/javascript">
			window.onload = function(){
				var log = document.getElementById('log');
				
				function asynFunc(i, ii, callback){
					log.innerHTML += i + ',' + ii + '<br/>';
					window.setTimeout(function(){
						callback();
					}, 500);
				}
				
				function asynFor(){
					Mr.asynIterator(Mr.range('[0, 3]'), function(i){
						var outer = this;
						Mr.asynIterator(Mr.range('[0, 3]'), function(ii){
							asynFunc(i, ii, this.callback());
						}, outer.callback());
					});
				}
				
				asynFor();
			}
		</script>
	</head>
	<body>
		<div id="log"></div>
	</body>
</html>